﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using MockPrjTeam2.DAO;
using MockPrjTeam2.Entity;
namespace MockPrjTeam2.Biz
{
    public class SupportingMeterialBiz
    {
        private SupportingMeterialDao supportingMeterialDao;
        public SupportingMeterialBiz()
        {
            supportingMeterialDao=new SupportingMeterialDao();
        }
        //method GetSupportingMaterialById()
        public DataTable GetSupportingMaterialById(int orgId)
        {
            
            return supportingMeterialDao.GetSupportingMeterialByOrgId(orgId);
        }
        public SupportingMeterial GetSupportingMaterialById1(int orgId)
        {
            SupportingMeterial supporting=new SupportingMeterial();
            DataTable dt=new DataTable();
            dt = supportingMeterialDao.GetSupportingMeterialByOrgId(orgId);
            foreach (DataRow dr in dt.Rows)
            {
                supporting.UserID =Convert.ToInt32(dr["UserID"]);
                //supporting.OrgId =Convert.ToInt32(dr["OrgID"]);
                //supporting.Description = dr["Description"].ToString();

            }
            return supporting;
        }
        //method GetSupportingMaterialInActive()
        public DataTable GetSupportingMaterialInActive(int orgId)
        {
            return supportingMeterialDao.GetSupportingMaterialInActive(orgId);
        }
        //SetActiveSupportingMaterial()
        public bool SetActiveSupportingMaterial(int SupportingMaterialId, bool status)
        {
            return supportingMeterialDao.SetActiveSupportingMaterial(SupportingMaterialId, status);
        }
        //GetSupportingById()
        public SupportingMeterial GetSupportingById(int idSupporting)
        {
            DataTable dt=new DataTable();
            SupportingMeterial supporting=new SupportingMeterial();
            dt = supportingMeterialDao.GetSupportingById(idSupporting);
            foreach (DataRow dr in dt.Rows)
            {
                supporting.Account = dr["Account"].ToString();
                supporting.Url = dr["Url"].ToString();
                supporting.Description = dr["Description"].ToString();
                supporting.AddDate =Convert.ToDateTime(dr["AddDate"]);
                supporting.Type = dr["Type"].ToString();
                supporting.UserID = Convert.ToInt32(dr["UserID"]);
                supporting.SuportingMeterialId = Convert.ToInt32(dr["SuportingMeterialID"]);
                supporting.OrgId = Convert.ToInt32(dr["OrgID"]);
            }
            return supporting;
        }
        //method AddSupportingMaterial()
        public bool AddSupportingMaterial(SupportingMeterial supportingMeterial)
        {
            return supportingMeterialDao.AddSupportingMaterial(supportingMeterial);
        }
        //method UpdateSupportingMaterial()
         public bool UpdateSupportingMaterial(SupportingMeterial supportingMeterial)
         {
             return supportingMeterialDao.UpdateSupportingMaterial(supportingMeterial);
         }
         //method SetActiveSupportingMateria()
        public bool SetActiveSupportingMateria(int SupportingMaterialId, bool status)
        {
            return supportingMeterialDao.SetActiveSupportingMateria(SupportingMaterialId, status);
        }
          //method SetSupportingMateriaInActive()
        public bool SetSupportingMateriaInActive(int SupportingMaterialId, bool status)
        {
            return supportingMeterialDao.SetSupportingMateriaInActive(SupportingMaterialId, status);
        }
    }
}